package com.liuzhilong.infrastructure.basic.factory.statics;

import com.liuzhilong.infrastructure.basic.factory.statics.factory.Product;
import com.liuzhilong.infrastructure.basic.factory.statics.factory.auto.AutoFactory;
import com.liuzhilong.infrastructure.basic.factory.statics.factory.simple.SimpleFactory;
import com.liuzhilong.infrastructure.basic.factory.statics.factory.types.TypeFactory;
import com.liuzhilong.infrastructure.basic.factory.statics.inner.SimpleEntity;
import com.liuzhilong.infrastructure.basic.factory.statics.inner.SimpleValue;

public class UseCase {





    /**
     * 普通的静态工厂
     */
    public  static void  useCaseStaticFactory() throws ClassNotFoundException {
        //普通的工厂
        Product product = SimpleFactory.getProduct1();
        product.doSome();
        product = TypeFactory.getProduct(TypeFactory.Type.PRODUCT1);
        product.doSome();
        Class.forName("com.liuzhilong.infrastructure.basic.factory.statics.factory.auto.AutoProduct1");
        Class.forName("com.liuzhilong.infrastructure.basic.factory.statics.factory.auto.AutoProduct2");
        product= AutoFactory.getProduct("product2");
        product.doSome();


    }

    /**
     * 普通的内部工厂
     */
    public static void useCaseOfInner(){
        //静态工厂创建实体
        SimpleEntity simpleEntity = SimpleEntity.defaultEntity();
        //从实体中获取值信息 用于对象传输
        SimpleValue value = SimpleValue.fromEntity(simpleEntity);
        //其他逻辑

    }

}
